package com.toe.sso.pojo.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 管理员登录DTO
 */

/**
 * <p>后台管理账户登录的DTO模板</p>
 *
 * <p>2021-12-14</p>
 * <ul>
 *     <li>增加Validation验证</li>
 * </ul>
 */
@ApiModel(value = "后台登录的DTO")
@Data
public class AdminLoginDTO{

    /**
     * 验证不通过时的提示文本的前缀
     */
    private static final String MESSAGE_PREFIX = "登录失败！";

    @ApiModelProperty(value = "手机号", name = "phone", example = "手机号", required = true)
    private String phone;

    @ApiModelProperty(value = "登录密码或者验证码", name = "password", example = "123456", required = true)
    @NotNull(message = MESSAGE_PREFIX + "密码不允许为空！")
    @Pattern(regexp = "^[\\u0020-\\u007e]{4,16}$", message = MESSAGE_PREFIX + "密码的长度必须是4~16位！")
    private String password;


}
